import React, { Component } from 'react';
import { StyleSheet, ScrollView, Text, View, Image } from 'react-native';
import { WingBlank, Flex, Toast, Button, TextareaItem } from '@ant-design/react-native';
import { GetCompanyInfo } from '~/api/company';

export default class DevelopersDetails extends React.Component {
    static navigationOptions = {
        title: '开发商详情',
    };
    constructor(porps) {
        super(porps);
        this.state = {
            CompanyDataID: this.props.navigation.getParam('CompanyDataID'),
            CompanyName: '',
            CityName: '',
            Address: '',
            LegalPerson: '',
            TaxID: '',
            Contacter: '',
            Telephone: '',
            BankPayee: '',
            BankAccounts: '',
            BankBranch: '',
            CompanyInfo: '',
        };
        GetCompanyInfo(this.state.CompanyDataID).then((r) => {
            if (r.code === 0) {
                this.setState({
                    CompanyName: r.data.CompanyName,
                    CityName: r.data.CityName,
                    Address: r.data.Address,
                    LegalPerson: r.data.LegalPerson,
                    TaxID: r.data.TaxID,
                    Contacter: r.data.Contacter,
                    Telephone: r.data.Telephone,
                    BankPayee: r.data.BankPayee,
                    BankAccounts: r.data.BankAccounts,
                    BankBranch: r.data.BankBranch,
                    CompanyInfo: r.data.CompanyInfo,
                });
            } else {
                Toast.info(r.msg, 1);
            }
        });
    }
    render() {
        return (
            <ScrollView style={{ flex: 1 }}>
                <WingBlank size='lg'>
                    <View style={{ flex: 1 }}>
                        <Flex style={{ width: '100%', height: 90, backgroundColor: '#FFFFFF', marginTop: 10, borderRadius: 5 }}>
                            {/* <Image style={{ width: 60, height: 60, borderRadius: 5 }} source={require('~/assets/my/nantou.png')} /> */}
                            <Flex direction='column' style={{ marginLeft: 10 }} justify='start' align='start'>
                                <Text style={{ fontweight: 'bold', marginLeft: 15, fontSize: 16 }}>{this.state.CompanyName}</Text>
                                <Text style={{ color: '#666666', marginLeft: 15, fontSize: 12, marginTop: 15 }}>{this.state.CityName}{this.state.Address}</Text>
                            </Flex>
                        </Flex>
                        <Flex style={{ width: '100%', height: 200, marginTop: 10, backgroundColor: '#FFFFFF', borderRadius: 5 }} direction='column'>
                            {/* <Flex justify='between' style={{ width: '100%' }}>
                                <Text style={styles.text}>资产余额：</Text>
                                <Text style={styles.texts}>16494664165</Text>
                            </Flex> */}
                            <Flex justify='between' style={{ width: '100%' }}>
                                <Text style={styles.text}>所在城区：</Text>
                                <Text style={styles.texts}>{this.state.CityName}</Text>
                            </Flex>
                            <Flex justify='between' style={{ width: '100%' }}>
                                <Text style={styles.text}>公司法人：</Text>
                                <Text style={styles.texts}>{this.state.LegalPerson}</Text>
                            </Flex>
                            <Flex justify='between' style={{ width: '100%' }}>
                                <Text style={styles.text}>税号</Text>
                                <Text style={styles.texts}>{this.state.TaxID}</Text>
                            </Flex>
                            <Flex justify='between' style={{ width: '100%' }}>
                                <Text style={styles.text}>联系人：</Text>
                                <Text style={styles.texts}>{this.state.Contacter}</Text>
                            </Flex>
                            <Flex justify='between' style={{ width: '100%' }}>
                                <Text style={styles.text}>联系电话：</Text>
                                <Text style={styles.texts}>{this.state.Telephone}</Text>
                            </Flex>
                        </Flex>
                        <Flex style={{ width: '100%', height: 125, marginTop: 10, backgroundColor: '#FFFFFF', borderRadius: 5 }} direction='column'>
                            <Flex justify='between' style={{ width: '100%' }}>
                                <Text style={styles.text}>收款账户：</Text>
                                <Text style={styles.texts}>{this.state.BankPayee}</Text>
                            </Flex>
                            <Flex justify='between' style={{ width: '100%' }}>
                                <Text style={styles.text}>收款账号：</Text>
                                <Text style={styles.texts}>{this.state.BankAccounts}</Text>
                            </Flex>
                            <Flex justify='between' style={{ width: '100%' }}>
                                <Text style={styles.text}>收款银行：</Text>
                                <Text style={styles.texts}>{this.state.BankBranch}</Text>
                            </Flex>
                        </Flex>
                        <Flex direction='column' justify='start' align='start' style={{ backgroundColor: '#FFFFFF', borderRadius: 5, marginTop: 10 }}>
                            <Text style={styles.text}>公司简介</Text>
                            <Text style={{ fontWeight: 'bold', marginLeft: 10, marginRight: 10, marginTop: 16, fontSize: 14, marginBottom: 10 }}>{this.state.CompanyInfo}</Text>
                        </Flex>
                    </View>
                </WingBlank>
            </ScrollView>
        )
    }
}
const styles = StyleSheet.create({
    text: {
        color: '#666666',
        fontSize: 14,
        marginTop: 15,
        marginLeft: 11,
    },
    texts: {
        fontWeight: 'bold',
        marginRight: 16,
        marginTop: 16,
        fontSize: 14,
    }
})